#ifndef NOTICE_COMMAND_IN_H_
#define NOTICE_COMMAND_IN_H_
#include "command.h"

#pragma pack(1)
namespace Cmd
{
        namespace Notice
        {
                //  cmd declaration
                enum {
                        CMDIN_LOGIN             = 0x0010,	// 登录NoticeServer验证指令
                        CMDIN_FORWARD           = 0x0011,	// 转发的指令
                        CMDIN_SESSION           = 0x0012,	// 与SessionServer交互的指令
                };
                enum { //CMDIN_LOGIN
                        SCMDIN_LOGIN                            = 0x0001,	// 请求登录NoticeServer
                        SCMDIN_LOGIN_RESPONCE                   = 0x0002,	// 登录NoticeServer返回
                };
                enum { //CMDIN_FORWARD
                        SCMDIN_FORWARD_NOTICE                   = 0x0001,       // 转发到NoticeServer的指令
                        SCMDIN_FORWARD_USER                     = 0x0002,       // NoticeServer转发指令给用户
                };
                enum { //CMDIN_SESSION
                        SCMDIN_SESSION_SEND_USERS               = 0x0001,
                        SCMDIN_SESSION_RETURN_USERS             = 0x0002,
                        SCMDIN_SESSION_REQ_NOTICE               = 0x0003,
                        SCMDIN_SESSION_SEND_OC_NOTICE           = 0x0004,
                        SCMDIN_SESSION_RETURN_OC_NOTICE_USER    = 0x0005,
                        SCMDIN_SESSION_SEND_OPLUS_NOTICE        = 0x0006,
                        SCMDIN_SESSION_RETURN_OPLUS_NOTICE      = 0x0007,
                        SCMDIN_SESSION_SEND_WEB_NOTICE          = 0x0008,
                        SCMDIN_SESSION_SEND_WEB_NOTICE_RES      = 0x0009,
                };

                //	cmd definition
                struct stLoginCmd:t_NullCmd
                {
                        stLoginCmd():
                                t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN)
                        {
                                dest_type_ = NOTICESERVER;
                                server_type_ = 0;
                                server_id_ = 0;
                        }
                        WORD dest_type_;
                        WORD server_type_;
                        DWORD server_id_;
                };
                struct stLoginResponce:t_NullCmd
                {
                        stLoginResponce():
                                t_NullCmd(CMDIN_LOGIN, SCMDIN_LOGIN_RESPONCE)
                        {
                        }
                };

                struct stForwardNotice:t_NullCmd
                {
                        stForwardNotice():
                                t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_NOTICE)
                        {
                                user_id_ = 0;
                                size_ = 0;
                        }
                        DWORD user_id_;
                        WORD size_;
                        BYTE data_[0];
                        DWORD getSize() const
                        {
                                return sizeof(*this)+size_*sizeof(data_[0]);
                        }
                };
                struct stForwardUser:t_NullCmd
                {
                        stForwardUser():
                                t_NullCmd(CMDIN_FORWARD, SCMDIN_FORWARD_USER)
                        {
                                user_id_ = 0;
                                size_ = 0;
                        }
                        DWORD user_id_;
                        WORD size_;
                        BYTE data_[0];
                        DWORD getSize() const
                        {
                                return sizeof(*this)+size_*sizeof(data_[0]);
                        }
                };
                struct stSessionSendUsers:
                        t_NullCmd
                {
                        stSessionSendUsers() :
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_SEND_USERS)
                        {
                                notice_id_ = 0;
                                notice_type_ = 1;
                                notice_len_ = 0;
                        }
                        DWORD notice_id_;
                        BYTE notice_type_;
                        WORD notice_len_;
                        char notice_[0];
                        DWORD getSize() {
                                return sizeof(*this)+notice_len_*sizeof(notice_[0]);
                        }
                };
                struct stSessionReturnUsers:
                        t_NullCmd
                {
                        stSessionReturnUsers():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_RETURN_USERS)
                        {
                                notice_id_ = 0;
                                num_ = 0;
                        }
                        DWORD notice_id_;
                        WORD num_;
                        DWORD users_[0];
                        DWORD getSize() {
                                return sizeof(*this)+num_*sizeof(users_[0]);
                        }
                };
                struct stSessionReqNotice:
                        t_NullCmd
                {
                        stSessionReqNotice():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_REQ_NOTICE)
                        {
                                user_id_ = 0;
                        }
                        DWORD user_id_;
                };
                struct stSessionSendOCNotice:
                        t_NullCmd
                {
                        stSessionSendOCNotice():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_SEND_OC_NOTICE)
                        {
                                openclass_id_ = 0;
                                room_id_ = 0;
                                notice_len_ = 0;
                        }
                        DWORD openclass_id_;
                        DWORD room_id_;
                        DWORD users_[20];
                        WORD notice_len_;
                        char notice_[0];
                        DWORD getSize() {
                                return sizeof(*this)+notice_len_*sizeof(notice_[0]);
                        }
                };
                struct stSessionReturnOCNoticeUser:
                        t_NullCmd
                {
                        stSessionReturnOCNoticeUser():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_RETURN_OC_NOTICE_USER)
                        {
                                openclass_id_ = 0;
                                user_id_ = 0;
                        }
                        DWORD openclass_id_;
                        DWORD user_id_;
                };
                struct stSessionSendOplusNotice:
                        t_NullCmd
                {
                        stSessionSendOplusNotice():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_SEND_OPLUS_NOTICE)
                        {
                                bzero(id_, sizeof(id_));
                                room_id_ = 0;
                                notice_len_ = 0;
                        }
                        char id_[64];
                        DWORD room_id_;
                        DWORD users_[20];
                        WORD notice_len_;
                        char notice_[0];
                        DWORD getSize() {
                                return sizeof(*this)+notice_len_*sizeof(notice_[0]);
                        }
                };
                struct stSessionReturnOplusNotice:
                        t_NullCmd
                {
                        stSessionReturnOplusNotice():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_RETURN_OPLUS_NOTICE)
                        {
                                bzero(id_, sizeof(id_));
                                user_id_ = 0;
                        }
                        char id_[64];
                        DWORD user_id_;
                };
                struct stSessionSendWebNotice:
                        t_NullCmd
                {
                        stSessionSendWebNotice():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_SEND_WEB_NOTICE)
                        {
                                notice_id_ = 0;
                                user_id_ = 0;
                                notice_len_ = 0;
                        }
                        DWORD notice_id_;
                        DWORD user_id_;
                        WORD notice_len_;
                        char notice_[0];
                        DWORD getSize() {
                                return sizeof(*this)+notice_len_*sizeof(notice_[0]);
                        }
                };
                struct stSessionSendWebNoticeRes:
                        t_NullCmd
                {
                        stSessionSendWebNoticeRes():
                                t_NullCmd(CMDIN_SESSION, SCMDIN_SESSION_SEND_WEB_NOTICE_RES)
                        {
                                notice_id_ = 0;
                                user_id_ = 0;
                        }
                        DWORD notice_id_;
                        DWORD user_id_;
                };
        }; //namespace Notice
}; //namespace Cmd
#pragma pack() //pack(1)

#endif //NOTICE_COMMAND_H_
